package com.example.demo.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.example.demo.pojo.User;
import com.example.demo.service.UserService;
import io.shardingsphere.transaction.annotation.ShardingTransactionType;
import io.shardingsphere.transaction.api.TransactionType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import service.TxService;

/**
 * @author cyt
 * @create 2021-03-21 11:16
 */
// RPC
@Service
public class TxServiceImpl implements TxService {
    @Autowired
    private UserService service;

    @Override
    public String testTx(Integer id) {
        User byId = service.getById(id);
        byId.setName("sharding jdbc");
        service.save(byId);
        return byId.toString();
    }
}
